<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <title>良品服装专卖店 - 首页</title>
    <!-- Custom styles for this template -->
    <link href="${pageContext.request.contextPath}/static/css/carousel.css" rel="stylesheet">
</head>
<body>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet"
      href="${pageContext.request.contextPath}/static/css/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet"
      href="${pageContext.request.contextPath}/static/css/bootstrap/css/default.css">
<!-- Custom styles for this template -->
<link href="${pageContext.request.contextPath}/static/css/carousel.css"
      rel="stylesheet">

<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="${pageContext.request.contextPath}/static/js/jquery-1.11.3.js"></script>
<script src="${pageContext.request.contextPath}/static/js/functions.js"></script>
<script src="${pageContext.request.contextPath}/static/js/cart.js"></script>

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="${pageContext.request.contextPath}/static/css/bootstrap/js/bootstrap.min.js"></script>

<c:import url="../common/userTopNav.jsp"/>

<div class="container-fluid">
    <div class="row">

        <script>
            $(document).ready(function () {
                $('#myCarousel').carousel();
            });
        </script>
        <div class="col-md-12">
            <!-- Carousel
            ================================================== -->
            <div id="myCarousel" class="carousel slide" data-ride="carousel">
                <!-- Indicators -->
                <ol class="carousel-indicators">
                    <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
                    <li data-target="#myCarousel" data-slide-to="1"></li>
                    <li data-target="#myCarousel" data-slide-to="2"></li>
                </ol>
                <div class="carousel-inner" role="listbox">
                    <div class="item active">

                        <img src="/static/images/adver/1.jpg" alt="First slide">
                        <div class="container">
                            <div class="carousel-caption">
                                <h1>良品专卖</h1>
                                <p></p>
                                <p><a class="btn btn-lg btn-primary" href='#loginFormModal' data-toggle='modal'>登录</a>
                                </p>
                            </div>
                        </div>
                    </div>
                    <div class="item">
                        <img class="second-slide" src="/static/images/adver/2.jpg" alt="Second slide">
                        <div class="container">
                            <div class="carousel-caption">
                                <p><a class="btn btn-lg btn-primary" href='#regFormModal' data-toggle='modal'>注册</a></p>
                            </div>
                        </div>
                    </div>
                    <div class="item">
                        <img class="third-slide" src="/static/images/adver/3.jpg" alt="Third slide">
                        <div class="container">
                            <div class="carousel-caption">
                                <p><a class="btn btn-lg btn-primary" href="../goods/getGoodsByCate?cateId=1">进入店铺</a>
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
                <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
                    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                    <span class="sr-only">Previous</span>
                </a>
                <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
                    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
                    <span class="sr-only">Next</span>
                </a>
            </div><!-- /.carousel -->
        </div>

        <div class="col-md-12">
            <div class="panel panel-info">
                <div class="panel-heading">
                    <h3>商品分类<a class="btn" href="${pageContext.request.contextPath}/category/getCategoryList">查看更多 »</a></h3>
                </div>
                <div class="panel-body" id="category">
                    <c:if test="${not empty categoryList}">
                        <c:forEach items="${categoryList}" var="category">
                            <div class="col-xs-6 col-md-3">
                                <div class="thumbnail">
                                    <a href="/product/getProductsByCid?cid=${category.cid}">
                                        <img src="${category.url}" alt="${category.name}" width="171" height="180">
                                    </a>
                                    <div class="caption" align="center"><p>${category.name}</p></div>
                                </div>
                            </div>
                        </c:forEach>
                    </c:if>
                    <center>
                        <c:if test="${empty categoryList}">
                            <h2>暂无商品分类</h2>
                        </c:if>
                    </center>
                </div>
            </div>
        </div>

        <div class="col-md-12">
            <div class="panel panel-success">
                <div class="panel-heading">
                    <h3>新到商品<a class="btn" href="${pageContext.request.contextPath}/product/getNewProduct">查看更多 »</a>
                    </h3>
                </div>
                <div class="panel-body">
                    <div id="newGoodsCarousel" class="carousel slide goods" data-ride="carousel">
                        <div class="carousel-inner" id="newGoods">
                            <c:forEach items="${newList}" var="item" varStatus="status">
                                <div
                                        <c:if test="${status.count==1}">class="item active goods" </c:if>
                                        <c:if test="${status.count!=1}">class="item goods"</c:if>>
                                    <div class="row">
                                        <c:forEach items="${item}" var="product">
                                            <div class="col-md-3">
                                                <a href="${pageContext.request.contextPath}/product/getProductDetail?pid=${product.pid}"
                                                   class="thumbnail">
                                                    <img src="${product.url}" alt="暂无图片" class="img-responsive"></a>
                                                <div class="container">
                                                    <div class="carousel-caption">${product.name}
                                                        <br>${product.store>0?"现货":"缺货"}<span class="badge">
                                                    <span class="glyphicon glyphicon-yen"></span>${product.freight}</span>
                                                    </div>
                                                </div>
                                            </div>
                                        </c:forEach>
                                    </div>
                                </div>
                            </c:forEach>
                        </div>

                        <a class="left carousel-control" href="#newGoodsCarousel" role="button" data-slide="prev">
                            <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                            <span class="sr-only">上一页</span>
                        </a>
                        <a class="right carousel-control" href="#newGoodsCarousel" role="button" data-slide="next">
                            <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
                            <span class="sr-only">下一页</span>
                        </a>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-md-12">
            <div class="panel panel-warning">
                <div class="panel-heading">
                    <h3>销售排行榜<a class="btn"
                                href="${pageContext.request.contextPath}/product/getHotSaleProduct">查看更多»</a></h3>
                </div>
                <div class="panel-body">
                    <div id="salesGoodsCarousel" class="carousel slide goods" data-ride="carousel">
                        <div class="carousel-inner" id="salesGoods">

                            <c:forEach items="${hotList}" var="list" varStatus="status">
                                <div
                                        <c:if test="${status.count==1}">class="item active goods" </c:if>
                                        <c:if test="${status.count!=1}">class="item goods"</c:if>>
                                    <div class="row">
                                        <c:forEach items="${list}" var="product">
                                            <div class="col-md-3">
                                                <a href="${pageContext.request.contextPath}/product/getProductDetail?pid=${product.pid}"
                                                   class="thumbnail">
                                                    <img src="${product.url}" alt="暂无图片" class="img-responsive"></a>
                                                <div class="container">
                                                    <div class="carousel-caption">${product.name}
                                                        <br>共售出<span class="badge">${product.sale}件</span></div>
                                                </div>
                                            </div>
                                        </c:forEach>
                                    </div>
                                </div>
                            </c:forEach>
                        </div>
                        <a class="left carousel-control" href="#salesGoodsCarousel" role="button" data-slide="prev">
                            <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                            <span class="sr-only">Previous</span>
                        </a>
                        <a class="right carousel-control" href="#salesGoodsCarousel" role="button" data-slide="next">
                            <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
                            <span class="sr-only">Next</span>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<c:import url="../common/userFooter.jsp"/>
</body>
</html>